<?php
namespace app\supermanager\validate;
use think\Validate;
class Camp extends Validate 
{
	protected $rule = [
        'travel_money_base'  	 =>  'require|integer',
        'rent_money_base'   	 =>  'require|integer',
        'area'              	 =>  'require',
        'name'               	 =>  'require',
        'count'              	 =>  'require',
        'campmanager_phone'      =>  'require|checkCampmanagerPhone',
        'campmanager_name'       =>  'require',
        'tel'              		 =>  'require',
        'email'               	 =>  'require|email',
        'address'                =>  'require',
        'legal_person'			 =>  'require',
    ];
    protected $message = [
        'travel_money_base.require'  =>  '营地旅行币基数不能为空',
        'rent_money_base.require'    =>  '营地单日出租基数不能为空',
        'travel_money_base.integer'  =>  '营地旅行币基数必须位数字',
        'rent_money_base.integer'    =>  '营地单日出租基数必须为数字',
        'area'                       =>  '所在热门城市不能为空',
        'name'						 =>  '营地名称不能为空',
        'count'						 =>  '泊位数量不能为空',
        'campmanager_phone'			 =>  '超级管理员手机不能为空',
        'campmanager_name'			 =>  '超级管理员姓名不能为空',
        'tel'						 =>  '营地联系电话不能为空',
        'email.require'				 =>  '邮箱不能为空',
        'email.email'				 =>  '邮箱格式错误',
        'address'					 =>  '详细地址不能为空',
        'legal_person'               =>  '法人代表不能为空',
    ];	
	protected  function checkCampmanagerPhone($value){
		if(false === Validate::regex($value,'/^(13[0-9]|14[5|7]|15[0-9]|18[0-9]|17[0-9])\d{8}$/'))
		{
			return '管理员手机号格式错误';
		}
		return true;
	}
}

?>